package com.corona.game.util;

import com.badlogic.gdx.math.Rectangle;
import com.badlogic.gdx.math.Vector2;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;

/* loaded from: pokewilds.jar:com/pkmngen/game/util/LoadingZone.class */
public class LoadingZone extends Rectangle {
    public LoadingZone inner;

    public LoadingZone() {
    }

    public LoadingZone(LoadingZone loadingZone) {
        super(loadingZone);
    }

    public Vector2 bottomLeft() {
        return new Vector2(this.x, this.y);
    }

    public Vector2 topRight() {
        return new Vector2(this.x + this.height, this.y + this.width);
    }

    public void translate(float x, float y) {
        Vector2 center = new Vector2();
        getCenter(center);
        center.add(x, y);
        setCenter(center);
        this.inner.setCenter(center);
    }

    public ArrayList<Vector2> diff(LoadingZone rect) {
        ArrayList<Vector2> allPositions = allPositions();
        Iterator it = new ArrayList(allPositions).iterator();
        while (it.hasNext()) {
            Vector2 pos = (Vector2) it.next();
            if (rect.contains(pos.cpy().add(8.0f, 8.0f))) {
                allPositions.remove(pos);
            }
        }
        return allPositions;
    }

    public ArrayList<Vector2> allPositions() {
        ArrayList<Vector2> allPositions = new ArrayList<>();
        Vector2 position = bottomLeft();
        while (position.y < topRight().y) {
            if (position.x > topRight().x) {
                position.add(0.0f, 16.0f);
                position.x = this.x - 16.0f;
            } else {
                allPositions.add(new Vector2(position));
            }
            position.add(16.0f, 0.0f);
        }
        return allPositions;
    }

    public ArrayList<Object> getAll(HashMap<Vector2, Object> hashMap) {
        ArrayList<Object> objects = new ArrayList<>();
        for (Vector2 pos : hashMap.keySet()) {
            if (contains(pos)) {
                objects.add(hashMap.get(pos));
            }
        }
        return objects;
    }
}
